<extend name="Public/base"/>
<block name="style">
    <style>
        .btn-jujue{background: #FF1717;}
        .btn-jujue:hover{background-color: #8d8d8d;}
    </style>
</block>
<block name="body">
    <div class="main-title">
        <h2></h2>
    </div>
    <form action="" method="post" class="form-horizontal">
        <input type="hidden" name="id" id="id" value="{$data['order_id']}">
        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: left;font-size: 18px;margin-bottom: 15px;color: #000;font-weight: bold;">个人信息</div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            订单号：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['order_no']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            箱型：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;"><?php echo $box[$data['order_type']]?></div>
                    </li>
                     <?php if(IS_CHEDUI<=1):?>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            下单公司：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['company_name']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            下单用户：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['company_user_name']}</div>
                    </li>
                    <?php endif;?>
                </ul>
            </div>
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: center;font-size: 18px;margin-bottom: 15px;"></div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            港口：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['port_name']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            装箱时间：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['shipment_time']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            截关时间：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['cutoff_time']}</div>
                    </li>
                    <?php if(IS_CHEDUI<=1):?>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            下单用户电话：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['company_user_phone']}</div>
                    </li>
                    <?php endif;?>
                </ul>
            </div>
        </div>
        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: left;font-size: 15px;margin-bottom: 15px;color: #000;font-weight: bold;">接单信息</div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            接单车队：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">
                            {$data['fleet_name']}
                            <?php if($data['order_status']==10&&$data['fleet_id']==0):?>
                            <a href="javascript:;" data-id="{$data['order_id']}"  class="chedui">分派车队</a>
                            <?php endif;?>
                            <?php if(IS_ROOT):?>
                            <?php if($data['order_status']==10 && $data['fleet_id']!=0):?>
                            <a href="javascript:;" data-id="{$data['order_id']}"  class="chedui">更换车队</a>
                            <?php endif;?>
                            <?php endif;?>
                        </div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            车牌号：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['car_no']}</div>
                    </li>

                </ul>
            </div>
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: center;font-size: 18px;margin-bottom: 15px;"></div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            接单司机：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">
                            {$data['driver_name']}
                            <?php if($data['order_status']==10&&$data['driver_id']==0):?>
                            <a href="javascript:;" data-id="{$data['order_id']}" chedui-id="{$data['fleet_id']}"  class="siji">分派司机</a>
                            <?php endif;?>
                            <?php if($data['order_status']==10&&$data['driver_id']!=0):?>
                            <a href="javascript:;" data-id="{$data['order_id']}" chedui-id="{$data['fleet_id']}"  class="siji">更换司机</a>
                            <?php endif;?>
                        </div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            司机电话：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['driver_phone']}</div>
                    </li>

                </ul>
            </div>

        </div>

        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: left;font-size: 15px;margin-bottom: 15px;color: #000;font-weight: bold;">拿箱单信息</div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            提单号：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['pick_no']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            拿箱地址：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['box_address_desc']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            箱号：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['box_no']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            集装箱照片：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">
                            <notempty name="data.box_img">
                                <volist name="data.box_img" id="vo">
                                    <a href='__ROOT__{$vo}' target='_blank'> <img src='__ROOT__{$vo}' width="50px" height='50px'></a>
                                </volist>
                            </notempty>
                        </div>
                    </li>

                </ul>
            </div>
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: center;font-size: 18px;margin-bottom: 15px;"></div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            联系人姓名：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['box_linkman']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            联系人电话：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['box_linkman_phone']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            封号：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['close_no']}</div>
                    </li>

                </ul>
            </div>

        </div>

        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 100%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: left;font-size: 15px;margin-bottom: 15px;color: #000;font-weight: bold;">装箱信息</div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <table border="1" style="">
                            <thead>
                                <tr style="background: #CCC;">

                                    <th>
                                        装箱地点
                                    </th>
                                    <th>
                                        详细地址
                                    </th>
                                    <th>
                                        装箱工姓名
                                    </th>
                                    <th>
                                        装箱工电话
                                    </th>

                                </tr>
                            </thead>
                            <tbody>
                            <notempty name="data.shipment_info">
                                <volist name="data.shipment_info" id="vo">
                                    <tr style="text-align: center">
                                        <td>
                                            {$vo.city}-{$vo.address}

                                        </td>
                                        <td>
                                            {$vo.province}{$vo.city}{$vo.address}{$vo.address_desc}
                                        </td>
                                        <td>
                                            {$vo.boxman_name}
                                        </td>
                                        <td>
                                            {$vo.boxman_phone}
                                        </td>

                                    </tr>
                                </volist>
                            </notempty>

                            </tbody>
                        </table>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            装箱物流：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['fleet_name']}</div>
                    </li>
                </ul>
            </div>
        </div>
        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 100%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: left;font-size: 15px;margin-bottom: 15px;color: #000;font-weight: bold;">备注</div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            备注：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['message']}</div>
                    </li>
                </ul>
            </div>
        </div>


        <div style="overflow: hidden;width: 100%;" class="form-item">
            <div style="float: left;width: 30%;">
                <div style="height: 40px;line-height: 40px;text-align: left;font-size: 15px;margin-bottom: 15px;color: #000;font-weight: bold;">
                    费用明细
                    （合计：￥<?php echo($data['order_price']+$data['other_price']+$data['admin_price']);?>）
                </div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            运费：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['order_price']}</div>
                    </li>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            额外费用：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['other_price']} <a href="{:U('otherPrice',array('id'=>$data['order_id']))}">查看明细</a></div>
                    </li>
                </ul>
            </div>
            <div style="float: left;width: 30%;">
                <div style="width: 100px;height: 40px;line-height: 40px;text-align: center;font-size: 18px;margin-bottom: 15px;"></div>
                <ul >
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            司机运费：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['driver_price']}</div>
                    </li>
                     <?php if(IS_CHEDUI<=1):?>
                    <li style="margin-bottom: 15px;overflow: hidden;line-height: 16px;">
                        <div style="text-align: left;float: left;font-weight: bold;font-size: 14px;">
                            平台加价：
                        </div>
                        <div style="float:left;margin-left: 10px;font-size: 14px;">{$data['admin_price']}</div>
                    </li>
                    <?php endif;?>
                </ul>
            </div>

        </div>

        <div class="form-item">
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
    <div class="show-box-back"  style="display: none;">
    </div>
    <!-- 分派车队 -->
    <div class="show-box" id="js-chedui" style="display: none;">
        <input type="hidden" name="order_id" id="js-chedui-id">
        <div class="show-box-msg" >
            派单给车队
        </div>
        <div class="show-box-msg-title">
            用户希望优先派单给:<span id="youxian"></span>
        </div>
        <div class="show-box-msg-area">
            <select name="chedui_id" id="chedui_id">
                <option value="0" selected>请选择接单车队</option>
                <notempty name="fleetlist">
                    <volist name="fleetlist" id="vo">
                        <option value="{$vo.fleet_id}" selected>{$vo.fleet_name}</option>
                    </volist>
                </notempty>

            </select>
        </div>
        <div class="show-box-bottom">
            <button class="js-show-btn-cancel btn btn-return" >返 回</button>
            <button class="btn submit-btn" id="submit-chedui" >派 单</button>

        </div>
    </div>

    <div class="show-box" id="js-siji" style="display: none;">
        <input type="hidden" name="order_id" id="js-siji-id">
        <div class="show-box-msg" >
            派单给司机
        </div>
        <div class="show-box-msg-title">
            用户希望优先派单给:<span id="youxian-siji"></span>
        </div>
        <div class="show-box-msg-area">
            <select name="siji_id" id="siji_id">
                <option value="0" selected>请选择接单司机</option>

            </select>
        </div>
        <div class="show-box-bottom">
            <button class="js-show-btn-cancel btn btn-return" >返 回</button>
            <button class="btn submit-btn" id="submit-siji" >派 单</button>

        </div>
    </div>

</block>

<block name="script">
    <script>

    </script>
    <script type="text/javascript">
        //搜索功能
        $(".chedui").click(function () {
            var id = $(this).attr("data-id");
            $.post("{:U('getRecmdDriver')}", {id: id}, function (res) {
                $("#youxian").html(res.data);
            });
            $('#js-chedui').show();
            $('.show-box-back').show();
            $('#js-chedui-id').val(id);
        });
        //搜索功能
        $(".siji").click(function () {
            var id = $(this).attr("data-id");
            var cheduiid = $(this).attr("chedui-id");
            $.post("{:U('getRecmdDriver')}", {id: id, chedui_id: cheduiid}, function (res) {
                $("#youxian-siji").html(res.data);
                $.each(res.driver, function (index, value) {
                    $("#siji_id").append("<option value='" + value.driver_id + "'>" + value.driver_name + "</option>");
                });
            });
            $('#js-siji').show();
            $('.show-box-back').show();
            $('#js-siji-id').val(id);
        });

        $("#submit-chedui").click(function () {
            var id = $("#js-chedui-id").val();
            var chedui_id = $("#chedui_id option:selected").val();
            $.post("{:U('allotFleet')}", {id: id, chedui_id: chedui_id}, function (res) {
                if (res.status) {
                    updateAlert('分派车队成功', 'alert-success');
                    setTimeout(function () {
                        location.reload();
                    }, 1500);
                }
            });
        });
        $("#submit-siji").click(function () {
            var id = $("#js-siji-id").val();
            var siji_id = $("#siji_id option:selected").val();
            $.post("{:U('allotDriver')}", {id: id, siji_id: siji_id}, function (res) {
                if (res.status) {
                    updateAlert('分派司机成功', 'alert-success');
                    setTimeout(function () {
                        location.reload();
                    }, 1500);
                }
            });
        });
        //导航高亮
        highlight_subnav('{:U('Order / index')}');
    </script>
</block>
